package math;

import io.GPSPoint;

import java.util.ArrayList;
import java.util.List;

import ui.TimeSeriesName;
import ui.TimeSeriesName.TimeSeriesType;

public class HeartRateProvider extends AbstractStatsProvider {

	@Override
	public TimeSeriesName getName(String name) {
		return new TimeSeriesName(TimeSeriesType.HEARTRATE, name, "Heart Rate / 10");
	}

	@Override
	void doWork() {
		List<Integer> hr = new ArrayList<Integer>();
		List<Long> timesL = new ArrayList<Long>();
		for (int i = 0; i < gpsTracks.size(); i++) {
			GPSPoint currentPoint = gpsTracks.get(i);
			hr.add(currentPoint.getHeartRate());
			timesL.add(currentPoint.getTime());
		}
		values = Utils.toDoublesFromInts(hr);
		for (int i = 0; i < values.length; i++) {
			values[i] /= 10.0;
 		}
		times = Utils.toLongs(timesL);
	}


}
